<extend name="default/template/base_index" />


<block name="area_header">

</block>

<block name="area_body">
    {:W('Menus/topbar')}
    <div class="admin-main container-fluid">
        {:W('Menus/left')}
        <div class="admin-main-content">
            {:W('Menus/breadcrumb')}
            <!-- 过滤\查询按钮 -->
            <a class="btn btn-sm btn-primary" href="{:U('Admin/RedEnvelopeTpl/add')}"><i class="fa fa-plus"></i>添加</a>
            <div>
                <table CLASS="table table-border table-hover">
                    <thead>
                        <tr>
                            <th>优惠券类别</th>
                            <th>过期时间（用户获得优惠券之后几天内过期）</th>
                            <th>使用条件</th>
                            <th>优惠券抵扣金额(元)</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        <volist name="list" id="vo">

                        <tr>
                            <td>
                                <a href="{:U('Admin/RedEnvelopeTpl/edit',array('id'=>$vo['id']))}">{$vo.dtree_type_name}</a>
                            </td>
                            <td>
                                <if condition="$vo['expire_time'] gt 365*10*24*3600">
                                    无限期
                                    <else/>
                                    获得{:($vo['expire_time']/24/3600)}天后过期
                                </if>
                            </td>
                            <td>
                                 <eq name="vo['use_condition']" value="0">
                                     无条件
                                     <else/>
                                    订单金额必须大于 {$vo['use_condition']} 才可使用
                                 </eq>
                            </td>
                            <td>
                                {$vo['money']}
                            </td>
                            <td>
                                <eq name="vo['status']" value="0">
                                    禁用
                                    <else/>
                                    启用
                                </eq>
                            </td>
                            <td>
                                <eq name="vo['status']" value="0">
                                    <a href="{:U('Admin/RedEnvelopeTpl/enable',array('id'=>$vo['id']))}" class="ajax-get btn btn-sm btn-primary">启用</a>
                                    <else/>
                                    <a href="{:U('Admin/RedEnvelopeTpl/disable',array('id'=>$vo['id']))}" class="ajax-get btn btn-sm btn-primary">禁用</a>
                                </eq>

                                <a class="btn btn-sm btn-primary" href="{:U('Admin/RedEnvelopeTpl/giveRedEnvelope',array('id'=>$vo['id']))}">手动发优惠券给用户</a>
                            </td>
                        </tr>

                        </volist>
                    </tbody>
                </table>

            </div>


        </div>

        <script type="text/javascript">
        </script>
    </div>
    <!-- END admin-main-content -->
    </div>
    <!-- END admin-main-->
</block>

<block name="area_footer">

</block>